with Ada.Real_Time;
with Ada.Text_IO;

use Ada.Real_Time;

package body Cyclic is

   task body Cyclic is

      Next_Period : Ada.Real_Time.Time;
      Period : constant Ada.Real_Time.Time_Span := Ada.Real_Time.Microseconds(Cycle_Time);

      -- Other declarations

      Increment : Positive;
      package X_IO is new Ada.Text_IO.Integer_IO(Positive);
      use X_IO;

   begin
      -- Initialization code

      Next_Period := Ada.Real_Time.Clock + Period;
      Increment := 1;
      loop

         delay until Next_Period; -- wait one whole period before executing
                                  -- Non-suspending periodic response code
                                  -- May include calls to protected procedures

         Ada.Text_IO.Put("Task ");
         X_IO.Put(Item => Id, Width => 3, Base => 10);
         Ada.Text_IO.Put("  -> Incrementador = ");
         X_IO.Put(Item => Increment, Width => 3, Base => 10);
         Ada.Text_IO.Put_Line("");

         Next_Period := Next_Period + Period;
         Increment := Increment + 1;

      end loop;
   end Cyclic;

end Cyclic;
